<?php defined('SYSPATH') OR die('No direct access allowed.');
if (isset($errors) && is_array($errors))
{?>
<div id="error">
<?php
	foreach ($errors as $message)
	{
	  echo __('Error:') . ' ' . $message . '<br />' . PHP_EOL;
	}
?>
</div>
<?php
}
echo Form::open();
?>
<fieldset>
  <legend><?php echo __('Login Details'); ?></legend>
  <ol>
    <li>
      <?php
        echo Form::label('email', __('Email Address:')) . PHP_EOL;
        echo Form::input('email', Arr::get($fields, 'email'), array('id' => 'email', 'maxlength' => 128)) . PHP_EOL;
      ?>
    </li>
    <li>
      <?php
        echo Form::radio('new_user', 'true', FALSE, array('id' => 'new_user_true', 'class' => 'login')) . PHP_EOL;
        echo Form::label('new_user_true', __('I am a new customer (You\'ll create a password later)'), array('class' => 'login')) . PHP_EOL;
      ?>
    </li>
    <li>
      <?php
        echo Form::radio('new_user', 'false', FALSE, array('id' => 'new_user_false', 'class' => 'login')) . PHP_EOL;
        echo Form::label('new_user_false', __('I am an existing customer, and my password is:'), array('class' => 'login')) . PHP_EOL;
      ?>
    </li>
    <li>
      <?php
        echo Form::input('password', NULL, array('type' => 'password', 'id' => 'password', 'maxlength' => 32, 'class' => 'login', 'onkeydown' => 'document.getElementById(\'new_user_false\').checked = \'checked\''));
      ?>
    </li>
    <li>
      <?php
        echo Form::checkbox('remember_me', NULL, FALSE, array('id' => 'remember_me'));
        echo Form::label('remember_me', __('Remember me - log me in automatically for the next 2 weeks'), array('class' => 'login'));
      ?>
    </li>
    <li>
        <?php
          echo Form::hidden('token', $token);
          echo Form::submit('submit', __('Continue'), array('class' => 'submit'));
        ?>
    </li>
  </ol>
</fieldset>
<?php
  echo Form::close();
?>